home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48_1
/
new.toq
< prev
next >
Wrap
Text File
|
1995-03-23
|
3KB
|
113 lines
Article 5408 of comp.sys.handhelds:
Newsgroups: comp.sys.handhelds
Path: en.ecn.purdue.edu!wscott
From: wscott@en.ecn.purdue.edu (Wayne H Scott)
Subject: Re: DEC2FRAC-II for the HP48SX
Message-ID: <1991Mar30.191031.26274@en.ecn.purdue.edu>
Organization: Purdue University Engineering Computer Network
References: <12222
Date: Sat, 30 Mar 91 19:10:31 GMT
In article <27f2c9cd:1772.4comp.sys.handhelds;1
>Wayne Scott asks for DEC2FRAC to parse equations like ->Q does.
>
>No problem. I'm on it...
>
>-- Joe Horn --
DO\->Q Version 1.1
Sorry I've already done it...
This program handles:
real numbers
complex numbers
equations
TAGGED objects
lists
and any combination of the above
{ .25 '.5*X-.75' (.25, -.333) }
10
DO\->Q
{ '1/4' '1/2*X-3/4' '1/4-1/3*i' }
I now have this programs assigned to my old \->Q key.
Many thanks to:
Joseph Korn for writing the DEC2FRAC program
and Jan Brittenson for showing me how to handle equations. (I never
knew OBJ\-> would do that) and for the SYSEVALS in DO\->Q.
[ sorry typed in by hand }
DO\->Q
Checksum: # 603Ch
Size: 424
\<< \-> A D
\<< A TYPE \-> T \<<
CASE T 0 ==
THEN A D D2F END
T 9 == THEN A OBJ\-> \-> n oper \<<
1 n START D DO\->Q n ROLL NEXT
oper
n 1 + # 18CEAh SYSEVAL @ n+1 as system binary
# 546Dh SYSEVAL @ join as algebraic
\>>
END
T 1 == THEN A RE D DO\->Q A IM D DO\->Q i * + END
T 5 == THEN A OBJ\-> \-> n \<< 1 n
START D DO\->Q n ROLL NEXT
n \->LIST \>>
END
T 12 == THEN
A OBJ\-> SWAP D DO\->Q SWAP \->TAG END
A
END
\>> \>> \>>
D2F is the same program posted eariler with the following changes.
D2F
Checksum: # 2667h
Size: 339
%%HP:T(3);
\<< DUP2
IF 1 > SWAP FP AND
THEN SWAP EVAL \-> c f @ added EVAL so it can handle '2/4'
\<< 0 1 f
WHILE OVER c < OVER AND
REPEAT INV DUP FP 4 ROLLD IP OVER * ROT + ROT
END DROP DUP2 c
IF DUP2 >
THEN - OVER / CEIL * -
ELSE 3 DROPN
END DUP2 1 2
START DUP f * 0 RND SWAP / f - ABS SWAP
NEXT
IF >
THEN SWAP
END DROP DUP f * 0 RND
\>>
IF OVER 0 < THEN NEG SWAP NEG ELSE SWAP END @ so -.25 -> -(1/4) not 1/-4
IF DUP ABS 1 >
THEN # 5603Eh SYSEVAL
ELSE DROP
END
ELSE DROP
END
\>>
Joe -- Is there a better way to handle negitive fractions?
--
_________________________________________________________________________
Wayne Scott | INTERNET: wscott@ecn.purdue.edu
Electrical Engineering | BITNET: wscott%ecn.purdue.edu@purccvm
Purdue University | UUCP: {purdue, pur-ee}!ecn.purdue.edu!wscott